package pers.zc.activiti.shujujiegou.duilie;

import java.awt.*;

/**
 * @Annotion: 链表实现队列
 * @ClassName: Lianbiao
 * @Author: Lin FuYuan
 * @Date: 2019/11/21  14:56
 * @Version: 1.0
 */
public class Lianbiao {

    class Node{
        Integer self = null;
        Node next = null;
        Node(Integer integer){
            self  = integer;
        }
    }

    private Node node = null;


    public void setNode(Integer n){
        if(node == null){
            node  = new Node(n);
            return ;
        }
        //引用传递
        Node no = node;
        while(no.next != null){
            no = no.next;
        }
        no.next = new Node(n);

    }

    public Integer getNode(){
        if(node.self == null){
            return null;
        }
        Integer result = node.self;
        node = node.next;
        return result;
    }
}
